﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SISCON.Model
{
    public class Schedule
    {
        private long _ScheduleId;
        private List<string> _Days;
        private DateTime _StartsAt;
        private DateTime _EndsAt;
        private Classroom _Classroom;

        public long ScheduleId
        {
            get { return _ScheduleId; }
            set { _ScheduleId = value; }
        }

        public List<string> Days
        {
            get { return _Days; }
            set { _Days = value; }
        }

        public DateTime StartsAt
        {
            get { return _StartsAt; }
            set { _StartsAt = value; }
        }

        public DateTime EndsAt
        {
            get { return _EndsAt; }
            set { _EndsAt = value; }
        }

        public Classroom Classroom
        {
            get { return _Classroom; }
            set { _Classroom = value; }
        }

        public string StartsAtString
        {
            get { return _StartsAt.ToString("HH:mm"); }
            set { }
        }

        public string EndsAtString
        {
            get { return _EndsAt.ToString("HH:mm"); }
            set { }
        }

        public List<int> DaysToInts
        {
            get
            {
                List<int> days = new List<int>();

                if (_Days != null && _Days.Count > 0)
                {
                    foreach (string day in _Days)
                    {
                        switch (day.ToUpper())
                        {
                            case "DO": days.Add(0); break;
                            case "LU": days.Add(1); break;
                            case "MA": days.Add(2); break;
                            case "MI": days.Add(3); break;
                            case "JU": days.Add(4); break;
                            case "VI": days.Add(5); break;
                            case "SA": days.Add(6); break;
                        }
                    }
                }

                return days;
            }
        }
    }
}